package gw.comp.combobox;

import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;
import javax.swing.JComboBox;

/**
 *
 * @author jcastillo
 */
public class ComboBoxPrincipal extends JComboBox{

    public ComboBoxPrincipal() {
        this(new ArrayList<ComboBoxBean>());
    }

    public ComboBoxPrincipal(ArrayList<ComboBoxBean> data) {
        initComponents();
        for (ComboBoxBean comboBoxBean : data) {
            addItem(comboBoxBean);
        }
    }

    public int getCodigo(){
        return ((ComboBoxBean)getSelectedItem()).getCodigo();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
